# -*- coding: utf-8 -*-

# Promogest
#
# Copyright (C) 2007 by Promotux Informatica - http://www.promotux.it/
# Author: Dr astico (Pinna Marco) <zoccolodignu@gmail.com>


import gtk
import promogest.ui.widgets
from promogest import Environment
from promogest.ui.widgets.DateWidget import DateWidget
from promogest.ui.widgets.ScontiWidget import ScontiWidget
from promogest.ui.widgets.PersonaGiuridicaSearchWidget import PersonaGiuridicaSearchWidget

class SchedeOrdinazioniEditWidget():

    def __init__(self):

        self.anagrafica_schede_ordinazioni_detail_vbox = gtk.VBox()
        self.label20 = gtk.Label()
        self.label20.set_markup('<b>Dati generali</b>')
        self.frame1 = gtk.Frame()
        self.frame1.set_label_widget(self.label20)
        self.frame1.set_border_width(5)
        self.label108 = gtk.Label()
        self.label108.set_markup('<b>Inserimento/Modifica</b>')
        self.frame17 = gtk.Frame(self.label108)
        self.frame17.set_label_widget(self.label108)
        self.articoli_treeview_frame = gtk.Frame()
        self.label119 = gtk.Label()
        self.label119.set_markup('<b>Dettagli stampa</b>')
        self.frame18 = gtk.Frame()
        self.frame18.set_label_widget(self.label119)
        self.label124 = gtk.Label()
        self.label124.set_markup('<b>Materiale</b>')
        self.frame19 = gtk.Frame()
        self.frame19.set_label_widget(self.label124)
        self.label129 = gtk.Label()
        self.label129.set_markup('<b>Dati spedizione</b>')
        self.frame20 = gtk.Frame()
        self.frame20.set_label_widget(self.label129)
        self.label134 = gtk.Label()
        self.label134.set_markup('<b>Finale</b>')
        self.frame21 = gtk.Frame()
        self.frame21.set_label_widget(self.label134)
        self.label30 = gtk.Label()
        self.label30.set_markup('<b>Consegna</b>')
        self.frame2 = gtk.Frame()
        self.frame2.set_label_widget(self.label30)
        self.label39 = gtk.Label()
        self.label39.set_markup('<b>Accesso utente / Selezione cliente</b>')
        self.frame4 = gtk.Frame()
        self.frame4.set_label_widget(self.label39)
        self.label151 = gtk.Label()
        self.label151.set_markup('<b>Recapiti e contatti cliente</b>')
        self.frame23 = gtk.Frame()
        self.frame23.set_label_widget(self.label151)
        self.label152 = gtk.Label()
        self.label152.set_markup('<b>Note</b>')
        self.note_text_frame = gtk.Frame()
        self.note_text_frame.set_label_widget(self.label152)

        self.listino_combobox = gtk.ComboBox()
        self.magazzino_combobox = gtk.ComboBox()
        self.carattere_stampa_combobox = gtk.ComboBox()
        self.colore_stampa_combobox = gtk.ComboBox()
        self.associazione_articoli_comboboxentry = gtk.ComboBoxEntry()

        self.dettagli_scheda_notebook  = gtk.Notebook()

        #Creazione della treeview
        self.articoli_treeview = gtk.TreeView()
        self.articoli_treeview.set_property('headers-visible', True)
        self.articoli_treeview.set_property('enable-grid-lines', True)
        self.articoli_treeview.set_property('fixed-height-mode', True)
        self.articoli_treeview.set_property('rules-hint', True)
        self.articoli_treeview.connect('cursor-changed',\
                                                        self.on_articoli_treeview_cursor_changed)
        self.articoli_treeview.connect('key-press-event',\
                                                        self.on_articoli_treeview_key_press_event)
        #creazione della textview
        self.note_text_textview = gtk.TextView()
##        self.note_text_textview.set_size_request(775,-1)
        self.note_text_textview.set_pixels_above_lines(3)
        self.note_text_textview.set_pixels_below_lines(3)
        self.note_text_textview.set_justification(gtk.JUSTIFY_FILL)
        self.note_text_textview.set_wrap_mode(gtk.WRAP_WORD)
        self.note_text_textview.set_left_margin(10)
        self.note_text_textview.set_right_margin(10)

        self.note_text_alignment = gtk.Alignment(xalign=0.5, yalign=0.5, xscale=1, yscale=1)
        self.note_text_alignment.set_border_width(5)
        self.articoli_treeview_alignment = gtk.Alignment(xalign=0.5, yalign=0.5, xscale=1, yscale=1)
        self.alignment25 = gtk.Alignment(xalign=0.5, yalign=0.5, xscale=1, yscale=1)
        self.alignment30 = gtk.Alignment(xalign=0.5, yalign=0.5, xscale=1, yscale=1)
        self.alignment31 = gtk.Alignment(xalign=0.5, yalign=0.5, xscale=1, yscale=1)
        self.alignment32 = gtk.Alignment(xalign=0.5, yalign=0.5, xscale=1, yscale=1)
        self.alignment33 = gtk.Alignment(xalign=0.5, yalign=0.5, xscale=1, yscale=1)
        self.alignment35 = gtk.Alignment(xalign=0.5, yalign=0.5, xscale=1, yscale=1)
        self.alignment5 = gtk.Alignment(xalign=0.5, yalign=0.5, xscale=1, yscale=1)
        self.alignment1 = gtk.Alignment(xalign=0.5, yalign=0.5, xscale=1, yscale=1)

        ##creazione scrolledwindows e settaggi proprieta
        self.scheda_views_scrolledwindow = gtk.ScrolledWindow()
        self.scheda_views_scrolledwindow.set_property('vscrollbar-policy', gtk.POLICY_ALWAYS)
        self.scheda_views_scrolledwindow.set_property('hscrollbar-policy', gtk.POLICY_ALWAYS)
        self.scheda_views_scrolledwindow.set_border_width(5)
        self.scheda_views_scrolledwindow1 = gtk.ScrolledWindow()
        self.scheda_views_scrolledwindow1.set_property('vscrollbar-policy', gtk.POLICY_ALWAYS)
        self.scheda_views_scrolledwindow1.set_property('hscrollbar-policy', gtk.POLICY_NEVER)
        self.scheda_views_scrolledwindow1.set_border_width(5)

        #questi sono custom widgets
        self.sconti_scheda_widget = ScontiWidget(str1='Sconti su totale')
        self.id_cliente_customcombobox = PersonaGiuridicaSearchWidget()

        self.data_matrimonio_entry = DateWidget(int1=10)
        self.data_spedizione_entry = DateWidget(int1=10)
        self.data_consegna_bozza_entry = DateWidget(int1=10)
        self.data_consegna_entry = DateWidget(int1=10)
        self.data_ordine_al_fornitore_entry = DateWidget(int1=10)
        self.data_ricevuta_entry = DateWidget(int1=10)
        self.data_presa_in_carico_entry = DateWidget(int1=10)

        #queste sono le vbox usate nella window
        self.articoli_scheda_vbox = gtk.VBox()
        self.articoli_scheda_vbox.set_spacing(5)
        self.articoli_scheda_vbox.set_border_width(5)
        self.dettagli_scheda_vbox = gtk.VBox()
        self.dettagli_scheda_vbox.set_spacing(5)
        self.dettagli_scheda_vbox.set_border_width(5)
        self.riferimenti_scheda_vbox = gtk.VBox()
        self.riferimenti_scheda_vbox.set_spacing(5)
        self.riferimenti_scheda_vbox.set_border_width(5)
        self.vbox1 = gtk.VBox()
        self.vbox1.set_spacing(5)
        self.vbox2 = gtk.VBox()
        self.vbox2.set_spacing(5)
        self.vbox14 = gtk.VBox()
        self.vbox14.set_spacing(5)
        self.vbox3 = gtk.VBox()
        self.vbox3.set_spacing(5)
        self.vbox36 = gtk.VBox()
        self.vbox36.set_spacing(5)
        self.vbox36.set_border_width(5)
        self.vbox37 = gtk.VBox()
        self.vbox37.set_spacing(5)
        self.vbox5 = gtk.VBox()
        self.vbox5.set_spacing(5)
        self.vbox38 = gtk.VBox()
        self.vbox38.set_spacing(5)
        self.vbox39 = gtk.VBox()
        self.vbox39.set_spacing(5)
        self.vbox42 = gtk.VBox()
        self.vbox41 = gtk.VBox()
        self.vbox43 = gtk.VBox()
        self.vbox43.set_spacing(5)
        self.vbox43.set_border_width(5)
        self.vbox44 = gtk.VBox()
        self.vbox44.set_spacing(5)
        self.vbox45 = gtk.VBox()
        self.vbox45.set_spacing(5)
        self.vbox45.set_border_width(5)
        self.vbox46 = gtk.VBox()
        self.vbox46.set_spacing(5)
        self.vbox47 = gtk.VBox()
        self.vbox47.set_spacing(5)
        self.vbox48 = gtk.VBox()
        self.vbox48.set_spacing(5)
        self.vbox49 = gtk.VBox()
        self.vbox49.set_spacing(5)
        self.vbox4 = gtk.VBox()
        self.vbox4.set_spacing(5)
        self.vbox4.set_border_width(5)

        #qui ci vanno le Hbox
        self.hbox2 = gtk.HBox()
        self.hbox2.set_spacing(5)
        self.hbox3 = gtk.HBox()
        self.hbox3.set_spacing(5)
        self.hbox6 = gtk.HBox()
        self.hbox6.set_spacing(5)
        self.hbox45 = gtk.HBox()
        self.hbox45.set_spacing(5)
        self.hbox46 = gtk.HBox()
        self.hbox46.set_spacing(5)
        self.hbox17 = gtk.HBox()
        self.hbox17.set_spacing(5)
        self.hbox48 = gtk.HBox()
        self.hbox48.set_spacing(5)
        self.hbox50 = gtk.HBox()
        self.hbox50.set_spacing(5)
        self.hbox51 = gtk.HBox()
        self.hbox51.set_spacing(5)
        self.hbox52 = gtk.HBox()
        self.hbox52.set_spacing(5)
        self.hbox18 = gtk.HBox()
        self.hbox18.set_spacing(5)
        self.hbox19 = gtk.HBox()
        self.hbox19.set_spacing(5)
        self.hbox53 = gtk.HBox()
        self.hbox53.set_spacing(5)
        self.hbox54 = gtk.HBox()
        self.hbox54.set_spacing(5)
        self.hbox55 = gtk.HBox()
        self.hbox55.set_spacing(5)
        self.hbox58 = gtk.HBox()
        self.hbox58.set_spacing(5)
        self.hbox59 = gtk.HBox()
        self.hbox59.set_spacing(5)
        self.hbox56 = gtk.HBox()
        self.hbox56.set_spacing(5)
        self.hbox57 = gtk.HBox()
        self.hbox57.set_spacing(5)
        self.hbox4 = gtk.HBox()
        self.hbox4.set_spacing(5)
        self.hbox5 = gtk.HBox()
        self.hbox5.set_spacing(5)
        self.hbox7 = gtk.HBox()
        self.hbox7.set_spacing(5)
        self.hbox8 = gtk.HBox()
        self.hbox8.set_spacing(5)
        self.hbox9 = gtk.HBox()
        self.hbox9.set_spacing(5)
        self.hbox10 = gtk.HBox()
        self.hbox10.set_spacing(5)
        self.hbox26 = gtk.HBox()
        self.hbox26.set_spacing(5)
        self.hbox26.set_border_width(5)
        self.hbox27 = gtk.HBox()
        self.hbox27.set_spacing(5)
        self.hbox28 = gtk.HBox()
        self.hbox28.set_spacing(5)
        self.hbox29 = gtk.HBox()
        self.hbox29.set_spacing(5)
        self.hbox30 = gtk.HBox()
        self.hbox30.set_spacing(5)
        self.hbox66 = gtk.HBox()
        self.hbox66.set_spacing(5)
        self.hbox65 = gtk.HBox()
        self.hbox65.set_spacing(5)
        self.hbox_lui_lei = gtk.HBox()
        self.hbox_lui_lei.set_spacing(5)


        #raccolta di checkbutton e radiobutton
        self.materiale_disponibile_si_checkbutton = gtk.CheckButton(label='Si')
        self.materiale_disponibile_no_checkbutton = gtk.CheckButton(label='No')
        self.bomba_si_checkbutton = gtk.CheckButton(label='Si')
        self.bomba_no_checkbutton = gtk.CheckButton(label='No')
        self.saldato_checkbutton = gtk.CheckButton(label='Documento Saldato')
        self.fattura_checkbutton = gtk.CheckButton(label='Fattura')
        self.ricevuta_checkbutton = gtk.CheckButton(label='Ricevuta')

        #collezione di entry
        self.numero_scheda_entry = gtk.Entry()
        self.numero_scheda_entry.set_width_chars(10)
        self.numero_scheda_entry.set_alignment(1)
        self.nomi_sposi_entry = gtk.Entry()
        self.nomi_sposi_entry.set_width_chars(10)
        self.nomi_sposi_entry.set_alignment(0.5)
        self.mezzo_ordinazione_entry = gtk.Entry()
        self.mezzo_spedizione_entry = gtk.Entry()
        self.codice_spedizione_entry  = gtk.Entry()
        self.provenienza_entry = gtk.Entry()
        self.provenienza_entry.set_width_chars(10)
        self.provenienza_entry.set_alignment(0.5)
        self.referente_entry = gtk.Entry()
        self.presso_entry = gtk.Entry()
        self.via_piazza_entry = gtk.Entry()
        self.via_piazza_entry.set_width_chars(30)
        self.num_civ_entry = gtk.Entry()
        self.num_civ_entry.set_max_length(5)
        self.zip_entry = gtk.Entry()
        self.zip_entry.set_width_chars(6)
        self.zip_entry.set_max_length(5)
        self.localita_entry = gtk.Entry()
        self.provincia_entry = gtk.Entry()
        self.stato_entry = gtk.Entry()
        self.telefono_entry = gtk.Entry()
        self.telefono_entry.set_width_chars(23)
        self.telefono_entry.set_max_length(15)
        self.cellulare_entry = gtk.Entry()
        self.cellulare_entry.set_width_chars(24)
        self.cellulare_entry.set_max_length(15)
        self.prima_email_entry = gtk.Entry()
        self.prima_email_entry.set_width_chars(55)
        self.seconda_email_entry = gtk.Entry()
        self.seconda_email_entry.set_width_chars(55)
        self.skype_entry = gtk.Entry()
        self.nome_contatto_entry = gtk.Entry()
        self.n_documento_entry = gtk.Entry()
        self.n_documento_entry.set_width_chars(25)
        self.n_documento_entry.set_alignment(1)
        self.note_final_entry = gtk.Entry()
        self.note_final_entry.set_width_chars(80)
        self.note_fornitore_entry = gtk.Entry()
        self.note_spedizione_entry = gtk.Entry()
        self.userid_entry = gtk.Entry()
        self.passwd_entry = gtk.Entry()
        self.lui_e_lei_entry = gtk.Entry()
        self.tot_lordo_entry = gtk.Entry()
        self.tot_lordo_entry.set_width_chars(8)
        self.tot_scontato_entry = gtk.Entry()
        self.tot_scontato_entry.set_width_chars(8)


        #collezione di labels.
        self.label21 = gtk.Label(u'Scheda N°')
        self.label22 = gtk.Label('Nomi degli sposi:')
        self.label70 = gtk.Label('Provenienza:')
        self.label24 = gtk.Label('Data matrimonio:')
        self.label25 = gtk.Label('Data ordine:')

        self.label103 = gtk.Label('Listino di riferimento:')
        self.label53 = gtk.Label('Magazzino:')
        self.label104 = gtk.Label('Associazione di Articoli:')

        self.label52 = gtk.Label('')


        self.label109 = gtk.Label('Totale lordo')
        self.label48 = gtk.Label('')
        self.label110 = gtk.Label('Totale scontato')
        self.label51 = gtk.Label('')
        self.label50 = gtk.Label('')
        self.label31 = gtk.Label('')
        self.label35 = gtk.Label('')
        self.label47 = gtk.Label('')
        self.label49 = gtk.Label('')
        self.label114 = gtk.Label('Articoli')# #1 page notebook
        self.label118 = gtk.Label(u'Bomb. in clichè')
        self.label117 = gtk.Label('Data consegna bozza:')
        self.label116 = gtk.Label('Colore')
        self.label115 = gtk.Label('Carattere')

        self.label122 = gtk.Label('Data ordine\nal fornitore:')
        self.label121 = gtk.Label('Ordinato tramite:')
        self.label120 = gtk.Label('Disponibile')
        self.label123 = gtk.Label('Annotazioni sulla fornitura')

        self.label125 = gtk.Label('Codice Spedizione')
        self.label126 = gtk.Label('Spedito il:')
        self.label127 = gtk.Label('Tramite:')
        self.label128 = gtk.Label('Annotazioni sulla Spedizione')

        self.label135 = gtk.Label('Stampa e Spedizione')# #2 page notebook
        self.label133 = gtk.Label('Data consegna:')
        self.label132 = gtk.Label('N° documento')
        self.label131 = gtk.Label('Annotazioni finali')
        self.label130 = gtk.Label('Data ricevuta:')

        self.label17 = gtk.Label('Referente')
        self.label17.set_width_chars(15)
        self.label18 = gtk.Label('Presso')
        self.label18.set_width_chars(15)
        self.label19 = gtk.Label('Via / Piazza')
        self.label19.set_width_chars(15)
        self.label23 = gtk.Label(u'N°')
        self.label23.set_width_chars(10)
        self.label26 = gtk.Label('C.A.P.')
        self.label26.set_width_chars(15)
        self.label27 = gtk.Label('Località')
        self.label27.set_width_chars(15)
        self.label28 = gtk.Label('Provincia')
        self.label28.set_width_chars(15)
        self.label29 = gtk.Label('Stato')
        self.label29.set_width_chars(-1)
        self.label32 = gtk.Label('User Id')
        self.label33 = gtk.Label('Password')
        self.label34 = gtk.Label('Cliente')
        self.label_lui_lei = gtk.Label('Lui & Lei')

        self.label150 = gtk.Label('Indirizzo e-mail')
        self.label149 = gtk.Label('e-mail alternativa')
        self.label148 = gtk.Label('Telefono')
        self.label147 = gtk.Label('Cellulare')
        self.label146 = gtk.Label('Contatto telefonico con:')
        self.label145 = gtk.Label('Skype Name')

        self.label153 = gtk.Label('Contatti\ne Annotazioni')#Notebook 3rd page-label

        #and here the buttons
        self.generazione_fattura_button = gtk.Button()
        self.duplicate_image = gtk.Image()
        self.duplicate_image.set_from_file(Environment.conf.guiDir +'duplica16x16.png')
        self.generazione_fattura_button.set_image(self.duplicate_image)
        self.generazione_fattura_button.set_label('Duplica in Fattura')
        self.aggiungi_articolo_button = gtk.Button()
        self.add_image = gtk.Image()
        self.add_image.set_from_file(Environment.conf.guiDir +'aggiungi16x16.png')
        self.aggiungi_articolo_button.set_image(self.add_image)
        self.aggiungi_articolo_button.set_label('Aggiungi articolo...')
        self.rimuovi_articolo_button = gtk.Button()
        self.remove_image = gtk.Image()
        self.remove_image.set_from_file(Environment.conf.guiDir +'sottrai16X16.png')
        self.rimuovi_articolo_button.set_image(self.remove_image)
        self.rimuovi_articolo_button.set_label('Rimuovi articolo')
        self.anag_clienti_button = gtk.Button()
        self.cliente_image = gtk.Image()
        self.cliente_image.set_from_file(Environment.conf.guiDir +'modifica16x16.png')
        self.anag_clienti_button.set_image(self.cliente_image)
        self.anagrafica_caratteri_button = gtk.Button()
        self.modify_image = gtk.Image()
        self.modify_image.set_from_file(Environment.conf.guiDir +'modifica16x16.png')
        self.anagrafica_caratteri_button.set_image(self.modify_image)
        self.anagrafica_colori_button = gtk.Button()
        self.modify_image1 = gtk.Image()
        self.modify_image1.set_from_file(Environment.conf.guiDir +'modifica16x16.png')
        self.anagrafica_colori_button.set_image(self.modify_image1)

        #here tables and each setting
        self.table9 = gtk.Table(rows=3,columns=2, homogeneous=False)
        self.table9.set_row_spacings(5)
        self.table9.set_col_spacings(5)
        self.table9.set_border_width(5)
        self.table10 = gtk.Table(rows=3,columns=2)
        self.table10.set_row_spacings(5)
        self.table10.set_col_spacings(5)
        self.table11 = gtk.Table(rows=3,columns=2)
        self.table11.set_row_spacings(5)
        self.table11.set_col_spacings(5)
        self.table11.set_border_width(5)
        self.table12 = gtk.Table(rows=4,columns=2)
        self.table12.set_row_spacings(5)
        self.table12.set_col_spacings(5)
        self.table12.set_border_width(5)


    def connect_callbacks(self):
        self.generazione_fattura_button.connect('clicked', self.on_generazione_fattura_button_clicked)
        self.anagrafica_colori_button.connect('clicked', self.on_anagrafica_colori_button_clicked)
        self.anagrafica_caratteri_button.connect('clicked', self.on_anagrafica_caratteri_button_clicked)
        self.anag_clienti_button.connect('clicked', self.on_anag_clienti_button_clicked)
        self.aggiungi_articolo_button.connect('clicked', self.on_aggiungi_articolo_button_clicked)
        self.rimuovi_articolo_button.connect('clicked', self.on_rimuovi_articolo_button_clicked)
        self.materiale_disponibile_si_checkbutton.connect('toggled',self.on_materiale_disponibile_si_checkbutton_toggled)
        self.materiale_disponibile_no_checkbutton.connect('toggled',self.on_materiale_disponibile_no_checkbutton_toggled)
        self.bomba_si_checkbutton.connect('toggled',self.on_bomba_si_checkbutton_toggled)
        self.bomba_no_checkbutton.connect('toggled',self.on_bomba_no_checkbutton_toggled)
        self.saldato_checkbutton.connect('toggled',self.on_saldato_checkbutton_toggled)
        self.fattura_checkbutton.connect('toggled',self.on_fattura_checkbutton_toggled)
        self.ricevuta_checkbutton.connect('toggled',self.on_ricevuta_checkbutton_toggled)
        self.listino_combobox.connect('changed', self.on_listino_combobox_changed)
        self.magazzino_combobox.connect('changed', self.on_magazzino_combobox_changed)
        self.carattere_stampa_combobox.connect('changed', self.on_carattere_stampa_combobox_changed)
        self.colore_stampa_combobox.connect('changed', self.on_colore_stampa_combobox_changed)
        self.associazione_articoli_comboboxentry.connect('changed', self.on_associazione_articoli_comboboxentry_changed)



    def pack_widgets(self):
        self.vbox1.pack_start(self.label21, expand=True, fill=True)
        self.vbox1.pack_start(self.numero_scheda_entry, expand=True, fill=True)
        self.vbox2.pack_start(self.label22, expand=True, fill=True)
        self.vbox2.pack_start(self.nomi_sposi_entry, expand=True, fill=True)
        self.vbox14.pack_start(self.label70,expand=True, fill=True)
        self.vbox14.pack_start(self.provenienza_entry, expand=True, fill=True)
        self.hbox3.pack_start(self.label24, expand=True, fill=True)
        self.hbox3.pack_start(self.data_matrimonio_entry, expand=False, fill=False)
        self.hbox6.pack_start(self.label25, expand=True, fill=True)
        self.hbox6.pack_start(self.data_presa_in_carico_entry, expand=False, fill=False)
        self.vbox3.pack_start(self.hbox3, expand=True, fill=True, padding=5)
        self.vbox3.pack_start(self.hbox6, expand=True, fill=True, padding=5)
        self.hbox2.pack_start(self.vbox1, expand=True, fill=True, padding=5)
        self.hbox2.pack_start(self.vbox2, expand=True, fill=True, padding=5)
        self.hbox2.pack_start(self.vbox14, expand=True, fill=True, padding=5)
        self.hbox2.pack_start(self.vbox3, expand=True, fill=True, padding=5)
        self.frame1.add(self.hbox2)


        self.vbox37.pack_start(self.label103,expand=True, fill=True)
        self.vbox37.pack_start(self.listino_combobox, expand=True, fill=True)
        self.vbox5.pack_start(self.label53,expand=True, fill=True)
        self.vbox5.pack_start(self.magazzino_combobox, expand=True, fill=True)
        self.vbox38.pack_start(self.label104,expand=True, fill=True)
        self.vbox38.pack_start(self.associazione_articoli_comboboxentry,expand=True, fill=True)
        self.hbox45.pack_start(self.vbox37, expand=True, fill=True)
        self.hbox45.pack_start(self.vbox5, expand=True, fill=True)
        self.hbox45.pack_start(self.vbox38, expand=True, fill=True)

        #packing di bottoni.
        #verificare che si possano impostare le propriet� dei bottoni da un'altra parte
        self.hbox46.pack_start(self.generazione_fattura_button, expand=True, fill=True)
        self.hbox46.pack_start(self.label52, expand=True, fill=True)
        self.hbox46.pack_start(self.aggiungi_articolo_button, expand=True, fill=True)
        self.hbox46.pack_start(self.rimuovi_articolo_button, expand=True, fill=True)
        self.vbox36.pack_start(self.hbox45, expand=True, fill=True, padding=5)
        self.vbox36.pack_start(self.hbox46, expand=True, fill=True, padding=5)
        self.alignment25.add(self.vbox36)
        self.frame17.add(self.alignment25)

        self.scheda_views_scrolledwindow.add(self.articoli_treeview)
        self.articoli_treeview_alignment.add(self.scheda_views_scrolledwindow)
        self.articoli_treeview_frame.add(self.articoli_treeview_alignment)

        self.hbox50.pack_start(self.label109, expand=False, fill=False)
        self.hbox50.pack_start(self.tot_lordo_entry, expand=True, fill=True)
        self.hbox50.pack_start(self.sconti_scheda_widget, expand=True, fill=False)
        self.hbox50.pack_start(self.label48, expand=True, fill=True)
        self.hbox50.pack_start(self.label110, expand=False, fill=False)
        self.hbox50.pack_start(self.tot_scontato_entry, expand=False, fill=False)
        self.hbox51.pack_start(self.label51, expand=True, fill=True)
        self.hbox51.pack_start(self.label50, expand=True, fill=True)
        self.hbox51.pack_start(self.label31, expand=True, fill=True)
        self.hbox51.pack_start(self.label35, expand=True, fill=True)
        self.hbox51.pack_start(self.label47, expand=True, fill=True)
        self.hbox51.pack_start(self.label49, expand=True, fill=True)
        self.vbox39.pack_start(self.hbox50,expand=True, fill=True)
        self.vbox39.pack_start(self.hbox51,expand=False, fill=False)

        self.hbox18.pack_start(self.colore_stampa_combobox, expand=True, fill=True)
        self.hbox18.pack_start(self.anagrafica_colori_button, expand=False, fill=False)
        self.vbox42.pack_start(self.label116, expand=True, fill=True)
        self.vbox42.pack_start(self.hbox18, expand=True, fill=True)

        self.hbox19.pack_start(self.carattere_stampa_combobox, expand=True, fill=True)
        self.hbox19.pack_start(self.anagrafica_caratteri_button, expand=False, fill=False)
        self.vbox41.pack_start(self.label115, expand=True, fill=True)
        self.vbox41.pack_start(self.hbox19, expand=True, fill=True)

        self.hbox53.pack_start(self.bomba_si_checkbutton, expand=True, fill=True)
        self.hbox53.pack_start(self.bomba_no_checkbutton, expand=True, fill=True)

        self.table9.attach(self.label118,0,1,1,2,xoptions=gtk.EXPAND|gtk.FILL)
        self.table9.attach(self.data_consegna_bozza_entry,1,2,2,3)
        self.table9.attach(self.label117,0,1,2,3,xoptions=gtk.EXPAND|gtk.FILL)
        self.table9.attach(self.vbox42,0,1,0,1,xoptions=gtk.EXPAND|gtk.FILL)
        self.table9.attach(self.vbox41,1,2,0,1,xoptions=gtk.EXPAND|gtk.FILL)
        self.table9.attach(self.hbox53,1,2,1,2,xoptions=gtk.EXPAND|gtk.FILL,yoptions=gtk.EXPAND|gtk.FILL)

        self.alignment30.add(self.table9)
        self.frame18.add(self.alignment30)

        self.hbox54.pack_start(self.materiale_disponibile_si_checkbutton, expand=True, fill=True)
        self.hbox54.pack_start(self.materiale_disponibile_no_checkbutton, expand=True, fill=True)
        self.table10.attach(self.label122,0,1,0,1,xoptions=gtk.EXPAND|gtk.FILL,yoptions=gtk.EXPAND|gtk.FILL)
        self.table10.attach(self.label121,0,1,1,2,xoptions=gtk.EXPAND|gtk.FILL,yoptions=gtk.EXPAND|gtk.FILL)
        self.table10.attach(self.label120,0,1,2,3,xoptions=gtk.EXPAND|gtk.FILL,yoptions=gtk.EXPAND|gtk.FILL)
        self.table10.attach(self.data_ordine_al_fornitore_entry,1,2,0,1)
        self.table10.attach(self.mezzo_ordinazione_entry,1,2,1,2,xoptions=gtk.EXPAND|gtk.FILL,yoptions=gtk.EXPAND|gtk.FILL)
        self.table10.attach(self.hbox54,1,2,2,3,xoptions=gtk.EXPAND|gtk.FILL)
        self.vbox44.pack_start(self.label123, expand=False, fill=False)
        self.vbox44.pack_start(self.note_fornitore_entry, expand=True, fill=True)
        self.vbox43.pack_start(self.table10, expand=True, fill=True)
        self.vbox43.pack_start(self.vbox44, expand=True, fill=True)
        self.alignment31.add(self.vbox43)
        self.frame19.add(self.alignment31)
        #
        self.hbox52.pack_start(self.frame18, expand=True, fill=True)
        self.hbox52.pack_start(self.frame19, expand=True, fill=True)
        #
        self.vbox46.pack_start(self.label125, expand=False, fill=False)
        self.vbox46.pack_start(self.codice_spedizione_entry, expand=False, fill=False)
        self.vbox47.pack_start(self.label126, expand=False, fill=False)
        self.vbox47.pack_start(self.data_spedizione_entry, expand=True, fill=False)
        self.vbox48.pack_start(self.label127, expand=False, fill=False)
        self.vbox48.pack_start(self.mezzo_spedizione_entry, expand=False, fill=False)
        self.hbox55.pack_start(self.vbox46, expand=True, fill=True)
        self.hbox55.pack_start(self.vbox47, expand=True, fill=True)
        self.hbox55.pack_start(self.vbox48, expand=True, fill=True)
        self.vbox49.pack_start(self.label128, expand=False, fill=False)
        self.vbox49.pack_start(self.note_spedizione_entry, expand=False, fill=False)
        self.vbox45.pack_start(self.hbox55, expand=False, fill=False)
        self.vbox45.pack_start(self.vbox49, expand=False, fill=False)
        self.alignment32.add(self.vbox45)
        self.frame20.add(self.alignment32)

        self.hbox59.pack_start(self.label130, expand=True, fill=True)
        self.hbox59.pack_start(self.data_ricevuta_entry, expand=False, fill=False)
        self.hbox58.pack_start(self.data_consegna_entry, expand=False, fill=False)
        self.hbox58.pack_start(self.saldato_checkbutton,  expand=True, fill=True)
        self.hbox58.pack_start(self.hbox59, expand=False, fill=True)

        self.hbox57.pack_start(self.fattura_checkbutton, expand=False, fill=False)
        self.hbox57.pack_start(self.ricevuta_checkbutton, expand=False, fill=False)
        self.hbox56.pack_start(self.n_documento_entry, expand=False, fill=True)
        self.hbox56.pack_start(self.hbox57, expand=False, fill=True)

        self.table11.attach(self.label133,0,1,0,1,yoptions=gtk.EXPAND|gtk.FILL)
        self.table11.attach(self.label132,0,1,1,2,yoptions=gtk.EXPAND|gtk.FILL)
        self.table11.attach(self.label131,0,1,2,3,yoptions=gtk.EXPAND|gtk.FILL)
        self.table11.attach(self.hbox58,1,2,0,1,xoptions=gtk.FILL,yoptions=gtk.EXPAND|gtk.FILL)
        self.table11.attach(self.hbox56,1,2,1,2,xoptions=gtk.FILL,yoptions=gtk.EXPAND|gtk.FILL)
        self.table11.attach(self.note_final_entry,1,2,2,3,yoptions=gtk.EXPAND|gtk.FILL)
        self.alignment33.add(self.table11)
        self.frame21.add(self.alignment33)


        self.hbox5.pack_start(self.label17, expand=False, fill=False)
        self.hbox5.pack_start(self.referente_entry, expand=True, fill=True)
        self.hbox7.pack_start(self.label18, expand=False, fill=False)
        self.hbox7.pack_start(self.presso_entry, expand=True, fill=True)
        self.hbox8.pack_start(self.label19, expand=False, fill=False)
        self.hbox8.pack_start(self.via_piazza_entry, expand=True, fill=True)
        self.hbox8.pack_start(self.label23, expand=False, fill=True)
        self.hbox8.pack_start(self.num_civ_entry, expand=True, fill=True)
        self.hbox9.pack_start(self.label26, expand=False, fill=False)
        self.hbox9.pack_start(self.zip_entry, expand=False, fill=False)
        self.hbox9.pack_start(self.label27, expand=False, fill=False)
        self.hbox9.pack_start(self.localita_entry, expand=True, fill=True)
        self.hbox10.pack_start(self.label28, expand=False, fill=False)
        self.hbox10.pack_start(self.provincia_entry, expand=True, fill=True)
        self.hbox10.pack_start(self.label29, expand=True, fill=True)
        self.hbox10.pack_start(self.stato_entry, expand=True, fill=True)
        self.vbox4.pack_start(self.hbox5, expand=True, fill=True)
        self.vbox4.pack_start(self.hbox7, expand=True, fill=True)
        self.vbox4.pack_start(self.hbox8, expand=True, fill=True)
        self.vbox4.pack_start(self.hbox9, expand=True, fill=True)
        self.vbox4.pack_start(self.hbox10, expand=True, fill=True)
        self.alignment1.add(self.vbox4)
        self.frame2.add(self.alignment1)

        self.hbox27.pack_start(self.label32, expand=True, fill=True)
        self.hbox27.pack_start(self.userid_entry, expand=True, fill=True)
        self.hbox28.pack_start(self.label33, expand=False, fill=False)
        self.hbox28.pack_start(self.passwd_entry, expand=True, fill=True)
        self.hbox_lui_lei.pack_start(self.label_lui_lei, expand=True, fill=True)
        self.hbox_lui_lei.pack_start(self.lui_e_lei_entry, expand=True, fill=True)
        self.hbox30.pack_start(self.id_cliente_customcombobox, expand=True, fill=True)
        self.hbox30.pack_start(self.anag_clienti_button, expand=False, fill=False)
        self.hbox29.pack_start(self.label34, expand=False, fill=False)
        self.hbox29.pack_start(self.hbox30, expand=True, fill=True)
        self.hbox26.pack_start(self.hbox27, expand=True, fill=True)
        self.hbox26.pack_start(self.hbox28, expand=True, fill=True)
        self.hbox26.pack_start(self.hbox_lui_lei, expand=True, fill=True)
        self.hbox26.pack_start(self.hbox29, expand=True, fill=True)
        self.alignment5.add(self.hbox26)
        self.frame4.add(self.alignment5)

        self.hbox66.pack_start(self.telefono_entry, expand=True, fill=True)
        self.hbox66.pack_start(self.label147, expand=True, fill=True)
        self.hbox66.pack_start(self.cellulare_entry, expand=True, fill=True)
        self.hbox65.pack_start(self.skype_entry, expand=True, fill=True)
        self.hbox65.pack_start(self.label146, expand=False, fill=True)
        self.hbox65.pack_start(self.nome_contatto_entry, expand=True, fill=True)
        self.table12.attach(self.label150,0,1,0,1)
        self.table12.attach(self.label149,0,1,1,2)
        self.table12.attach(self.label148,0,1,2,3)
        self.table12.attach(self.prima_email_entry,1,2,0,1, xoptions=gtk.FILL,yoptions=gtk.EXPAND|gtk.FILL)
        self.table12.attach(self.seconda_email_entry,1,2,1,2, xoptions=gtk.FILL,yoptions=gtk.EXPAND|gtk.FILL)
        self.table12.attach(self.hbox66,1,2,2,3, xoptions=gtk.FILL,yoptions=gtk.EXPAND|gtk.FILL)
        self.table12.attach(self.hbox65,1,2,3,4, xoptions=gtk.EXPAND|gtk.FILL,yoptions=gtk.EXPAND|gtk.FILL)
        self.table12.attach(self.label145,0,1,3,4, yoptions=gtk.EXPAND|gtk.FILL)
        self.alignment35.add(self.table12)
        self.frame23.add(self.alignment35)

        self.scheda_views_scrolledwindow1.add(self.note_text_textview)
        self.note_text_alignment.add(self.scheda_views_scrolledwindow1)
        self.note_text_frame.add(self.note_text_alignment)
        #raccolta dei frame nelle rispettive v/hbox

        self.articoli_scheda_vbox.pack_start(self.frame17, expand=False, fill=False)
        self.articoli_scheda_vbox.pack_start(self.articoli_treeview_frame, expand=True, fill=True)
        self.articoli_scheda_vbox.pack_start(self.vbox39, expand=False, fill=False)

        self.dettagli_scheda_vbox.pack_start(self.hbox52, expand=False, fill=False)
        self.dettagli_scheda_vbox.pack_start(self.frame20, expand=False, fill=False)
        self.dettagli_scheda_vbox.pack_start(self.frame21, expand=False, fill=False)

        self.riferimenti_scheda_vbox.pack_start(self.frame2, expand=False, fill=False)
        self.riferimenti_scheda_vbox.pack_start(self.frame4, expand=False, fill=True)
        self.riferimenti_scheda_vbox.pack_start(self.frame23, expand=False, fill=False)
        self.riferimenti_scheda_vbox.pack_start(self.note_text_frame, expand=True, fill=True)

        #packing della notebook
        self.dettagli_scheda_notebook.append_page(self.articoli_scheda_vbox, tab_label=self.label114)
        self.dettagli_scheda_notebook.append_page(self.dettagli_scheda_vbox, tab_label=self.label135)
        self.dettagli_scheda_notebook.append_page(self.riferimenti_scheda_vbox, tab_label=self.label153)

        #packing finale della vbox principale
        self.anagrafica_schede_ordinazioni_detail_vbox.pack_start(self.frame1, expand=False, fill=True)
        self.anagrafica_schede_ordinazioni_detail_vbox.pack_start(self.dettagli_scheda_notebook, expand=True, fill=True)

    def on_materiale_disponibile_si_checkbutton_toggled(self, checkbutton):
        pass
    def on_materiale_disponibile_no_checkbutton_toggled(self, checkbutton):
        pass
    def on_saldato_checkbutton_toggled(self, checkbutton):
        pass
    def on_bomba_no_checkbutton_toggled(self, checkbutton):
        pass
    def on_bomba_si_checkbutton_toggled(self, checkbutton):
        pass
    def on_fattura_checkbutton_toggled(self, checkbutton):
        pass
    def on_ricevuta_checkbutton_toggled(self, checkbutton):
        pass
    def on_carattere_stampa_combobox_changed(self, combobox):
        pass
    def on_colore_stampa_combobox_changed(self, combobox):
        pass
    def on_magazzino_combobox_changed(self, combobox):
        pass
    def on_listino_combobox_changed(self, combobox):
        pass
    def on_associazione_articoli_comboboxentry_changed(self, combobox):
        pass

    def on_anag_clienti_button_clicked(self, button):
        pass
